package com.adcc.swingui.demo.menubar;

import java.awt.Container;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

import com.adcc.swingui.base.DefaultMenuBar;
import com.jidesoft.swing.JideMenu;

/**
 * 帮助菜单
 * 
 * @author charlie
 * 
 */

public class HelpMenuBut extends DefaultMenuBar {

	JMenu menu;

	JMenuItem updateItem;
	JMenuItem autoItem;
	JMenuItem aboutItem;
	JMenuItem helpItem;

	public HelpMenuBut(Container container) {
		super(container);
	}

	@Override
	protected JComponent build() {
		// TODO Auto-generated method stub
		menu = new JideMenu("帮助");
		menu.setMnemonic('H');

		// 智能升级
		updateItem = new JMenuItem("智能升级", new ImageIcon(
				"res/images/update.png"));
		addChildMenu(menu, updateItem, "updateVer", true);

		// 授权
		autoItem = new JMenuItem("授权",
				new ImageIcon("res/images/authorize.png"));
		addChildMenu(menu, autoItem, "authorize", true);

		// 关于
		aboutItem = new JMenuItem("关于", new ImageIcon("res/images/about.png"));
		addChildMenu(menu, aboutItem, "about", true);

		// 帮助
		helpItem = new JMenuItem("帮助", new ImageIcon("res/images/help.png"));
		addChildMenu(menu, helpItem, "help", true);
		return menu;
	}

	/**
	 * 智能升级
	 */
	public void updateVer() {
		System.out.println("updata");
	}

	/**
	 * 关于
	 */
	public void about() {
		System.out.println("about");
	}

	/**
	 * 授权
	 */
	public void authorize() {
		System.out.println("authorize");
	}

	/**
	 * 帮助
	 */
	public void help() {
		System.out.println("help");
	}

	@Override
	protected void offLineVisiable(List<JComponent> jcomps) {
		// TODO Auto-generated method stub

	}
}
